package de.dhbwstuttgart.vincon.telefoncompany.model;

import java.util.ArrayList;
import java.util.List;

public class Customer {
	private String forename;
	private String surname;
	private List<Phone> phones;	
	
	public Customer(String forename, String surname) {
		this.setForename(forename);
		this.setSurname(surname);
		
		phones = new ArrayList<Phone>();
	}
	
	public boolean addPhone(Phone phone){
		return phones.add(phone);
	}
	
	public Phone getRandomPhone(){
		return phones.get((int)(Math.random()*phones.size()));
	}
	
	public Phone getPhone(int index){
		return phones.get(index);
	}
	
	public List<Phone> getPhones(){
		return phones;
	}
	
	public Phone deletePhone(int index){
		return phones.remove(index);
	}
	
	public boolean deletePhone(Phone phone){
		return phones.remove(phone);
	}

	public String getForename() {
		return forename;
	}

	public void setForename(String forename) {
		this.forename = forename;
	}

	public String getSurname() {
		return surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}
	
	public String getName(){
		return forename + " " + surname; 
	}
}
